package com.kt.app.ui.components


import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.kt.app.R

@Composable
fun ListItemSample() {
    ListItem(
        modifier = Modifier.padding(5.dp),
        leadingContent = {
            Column(
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Image(
                    contentScale = ContentScale.FillWidth,
                    modifier = Modifier.size(35.dp).clip(CircleShape),
                    painter = painterResource(R.drawable.beautiful1),
                    contentDescription = "Home",
                )
                Text("小妹")

            }

        },
        overlineContent = { Text(text="科技快讯", color = Color.Blue) },
        headlineContent = { Text(text="智能眼镜销量同比增长超8倍") },
        supportingContent = {
            Text(
                text="受益于AI大模型与增强现实技术的深度融合，近期，智能眼镜市场不断升温，线上线下销售火热。某电商平台数码业务部负责人介绍，智能眼镜市场呈现出了爆发式的增长，成交量同比增长超过了8倍。数据显示，2025年全球智能眼镜出货量预计将达到1280万台，同比增长26%；其中，中国市场将突破275万台，同比增长高达107%，跃居全球第一。",
                maxLines = 2,
                fontSize = 12.sp,
                overflow = TextOverflow.Ellipsis

            ) },
        trailingContent = { Icon(imageVector = Icons.Default.MoreVert,  contentDescription = "More") }
    )
}

@Preview
@Composable
fun ListItemSamplePreview() {
    ListItemSample()
}

